package com.youku.wangheng.test;

import java.awt.Color;
import java.util.Random;

public class VarifyCode {

	private static int width = 80;
	
	private static int height = 40;
	
	private static int fontHeight ;
	
	private static int codeX = 0;
	private static int codeY = 0;
	
	private static String initLetterList() {
		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < 10 ; i++) {
			sb.append(i);
		}
		for(int i = 0 ; i < 26 ; i++) {
			sb.append((char)((int)'a'+i));
		}
		for(int i = 0 ; i < 26 ; i++) {
			sb.append((char)((int)'A'+i));
		}
		return sb.toString();
	}
	
	private static String creatValidateString(int lenth) {
		StringBuilder sb = new StringBuilder();
		String srcStr = initLetterList();
		Random random = new Random();
		for(int i = 0 ; i < lenth ; i++) {
			int skep = random.nextInt(srcStr.length());
			sb.append(srcStr.charAt(skep));
		}
		return sb.toString();
	}
	
	private int CreateRandomFontStyle(int randNum) {
		if(randNum < 200) return 0;
		if(randNum < 400) return 1;
		if(randNum < 600) return 2;
		if(randNum < 800) return 3;
		if(randNum < 1000) return 4;
		return 4;
	}
	
	private static Color randomColor() {
		int[] RGB = new int[3];
		Random random = new Random();
		RGB[0] = random.nextInt(255);
		RGB[1] = random.nextInt(255);
		RGB[2] = random.nextInt(255);
		Color c = new Color(RGB[0], RGB[1], RGB[2]);
		return c;
	}
	
	public static void main(String[] args) {
		System.out.println(initLetterList());
		System.out.println(creatValidateString(10));
	}
}
